package tms.util.logging;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;

import static tms.util.logging.AreaType.*;

@ApplicationScoped
public class LoggingManager {

    @Produces
    @ApplicationScoped
    public Logger getMainLogger() {
        return LoggerFactoryBase.getFactory().getLogger(ALL);
    }

    @Produces
    @Area(JABBER)
    @ApplicationScoped
    public Logger getJabberLogger() {
        return LoggerFactoryBase.getFactory().getLogger(JABBER);
    }

    @Produces
    @Area(MAIL)
    @ApplicationScoped
    public Logger getMailLogger() {
        return LoggerFactoryBase.getFactory().getLogger(MAIL);
    }

    @Produces
    @Area(BUSINESS)
    @ApplicationScoped
    public Logger getBusinessLogger() {
        return LoggerFactoryBase.getFactory().getLogger(BUSINESS);
    }

    @PostConstruct
    private void init() {
        LoggerFactoryBase.getFactory().getLogger(ALL);    
    }
}
